﻿// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED!
// YOU MAY USE THIS CODE: HOWEVER THIS GRANTS NO FUTURE RIGHTS.
// see https://spsearchbestbetsmigration.codeplex.com/license and https://spsearchbestbetsmigration.codeplex.com/ for further details and license information

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.XPath;

namespace SPSearchBestBetsMigration
{
    internal class SearchBestBets
    {
        private const string titleXPath = "Title";
        private const string urlXPath = "Url";
        private const string descXPath = "Description";

        public string Title { get; set; }
        public string URL { get; set; }
        public string Description { get; set; }

        public SearchBestBets(XPathNavigator nav)
        {
            XPathNavigator titleNode = nav.SelectSingleNode(titleXPath);
            if (!string.IsNullOrEmpty(titleNode.Value))
            {
                this.Title = titleNode.Value;
            }
            XPathNavigator urlNode = nav.SelectSingleNode(urlXPath);
            if (!string.IsNullOrEmpty(urlNode.Value))
            {
                this.URL = urlNode.Value;
            }
            XPathNavigator dNode = nav.SelectSingleNode(descXPath);
            if (!string.IsNullOrEmpty(dNode.Value))
            {
                this.Description = dNode.Value;
            }
        }
    }
}
